This script is the repeatable script for measuring changes in the different diversity metrics and how they are affected by the different stressors. In this section we are going to analyse the results from the optim.replicates chain

Results per metrics

Here I'm going to display the results in box plot for each metric in each broad category. > We can probably think of a better way to display the results in the future.

For each metric displayed here:

Scaling and centring the results

We centre the metric based on the null results by substracting the score of the metric from the randomly reduced trait space to the stressed trait space (i.e. \(score_{centred} = score_{stressed} - score_{random}\)). We then scale the centred metric by dividing it by it's maximum absolute centred value between all stressors (i.e. \(score_{scaled} = score_{centred} / \text{max}(|scores_{centred}|))\)).

Measuring the statistics for each metric

To measure the differences between the random and stressed metric scores, we ran paired t-tests between each pairs of unscaled metric score for the random reduction of the trait space and the stressed reduction of the trait space (t.test(random_scores, stressor_scores, paired = TRUE)).

To check the trend in the different level of data removals (20, 40, 60 and 80%) using a linear model with the \(scores_{scaled}\) as a response to the different removal levels (lm(scaled_metric ~ removal_level).

Results of the model scaled metric ~ removal level per stressor
equalizing.Slope equalizing.adj.R^2 facilitation.Slope facilitation.adj.R^2 filtering.Slope filtering.adj.R^2 competition.Slope competition.adj.R^2
TPD_TPD_regularity 0.24*** 0.637 0.044*** 0.037 0.111*** 0.199 0.018** 0.008
hypervolume_BAT_regularity -0.001 -0.001 0.004 -0.001 0.064*** 0.093 0.015** 0.009
dendrogram_BAT_regularity 0 -0.001 0.004*** 0.167 -0.003 -0.001 0.002*** 0.032
dissimilarity_FD_regularity 0.004. 0.003 0.189*** 0.87 0.008 0.001 0.015*** 0.06
TPD_TPD_divergence 0.176*** 0.618 0.01. 0.003 0.087*** 0.15 0.042*** 0.084
hypervolume_BAT_divergence 0.105*** 0.545 0.018*** 0.038 0.049*** 0.096 0.012*** 0.03
dendrogram_BAT_divergence 0.09*** 0.455 0.023*** 0.113 0.04*** 0.044 0.016*** 0.101
dissimilarity_melodicMPD_divergence(MPD) 0.167*** 0.895 0.038*** 0.158 0.076*** 0.186 0.032*** 0.172
dissimilarity_melodicRao_divergence(Rao) 0.165*** 0.903 0.039*** 0.173 0.075*** 0.177 0.032*** 0.192
dissimilarity_FD_divergence(Rao) 0.131*** 0.616 0.005 0.001 0.004 -0.001 0.003 0
dissimilarity_FD_divergence -0.046*** 0.074 0.005 -0.001 -0.001 -0.001 0.026*** 0.027
TPD_TPD_richness 0.084*** 0.393 0.026*** 0.085 0.05*** 0.099 0.02*** 0.066
hypervolume_BAT_richness 0.034*** 0.066 -0.001 -0.001 0.017** 0.013 0.004 0
convex hull_BAT_richness 0.042*** 0.098 0.014*** 0.015 0.033*** 0.05 0.015*** 0.024
dendrogram_BAT_richness 0.112*** 0.713 0.062*** 0.464 0.059*** 0.092 0.022*** 0.116
Average difference between the null metric and the stressed metric (raw) for each level of removal and each stressor
equa.rm1 equa.rm2 equa.rm3 faci.rm1 faci.rm2 faci.rm3 filt.rm1 filt.rm2 filt.rm3 comp.rm1 comp.rm2 comp.rm3
TPD_TPD_regularity 0.086*** 0.041*** 0.008*** 0.018*** 0.017*** 0.009*** 0.054*** 0.035*** 0.018*** 0.043*** 0.037*** 0.034***
hypervolume_BAT_regularity -0.006 -0.004 -0.006. 0.007 0.013** 0.009** 0.091*** 0.07*** 0.057*** 0.028*** 0.022*** 0.021***
dendrogram_BAT_regularity 0 0** 0** 0.002*** 0* 0 0.01*** 0.01*** 0.011*** 0.001*** 0. 0**
dissimilarity_FD_regularity -0.028*** -0.036*** -0.035*** 0.255*** 0.161*** 0.067*** 0.02** 0.021*** 0.013* 0.028*** 0.025*** 0.018***
TPD_TPD_divergence 0.106*** 0.043*** 0.006** -0.002 -0.003 -0.007** 0.045*** 0.006 -0.01** 0.046*** 0.033*** 0.03***
hypervolume_BAT_divergence 3.101*** 2.413*** 1.831*** 0.997*** 0.865*** 0.729*** 2.01*** 1.573*** 1.286*** 0.728*** 0.622*** 0.542***
dendrogram_BAT_divergence 0.228*** 0.151*** 0.1*** 0.081*** 0.069*** 0.053*** 0.154*** 0.118*** 0.094*** 0.064*** 0.054*** 0.046***
dissimilarity_melodicMPD_divergence(MPD) 0.177*** 0.121*** 0.083*** 0.059*** 0.049*** 0.039*** 0.109*** 0.081*** 0.063*** 0.053*** 0.041*** 0.035***
dissimilarity_melodicRao_divergence(Rao) 0.173*** 0.12*** 0.082*** 0.058*** 0.049*** 0.039*** 0.108*** 0.082*** 0.064*** 0.051*** 0.041*** 0.035***
dissimilarity_FD_divergence(Rao) 2.799*** 2.047*** 1.407*** 0.887*** 0.798*** 0.645*** 1.267*** 1.137*** 0.934*** 0.735*** 0.63*** 0.536***
dissimilarity_FD_divergence -0.045*** -0.041*** -0.034*** -0.006. -0.003 -0.006*** -0.004 -0.01*** -0.004 0.012*** 0.001 0.001
TPD_TPD_richness 68.84*** 70.55*** 63.552*** 32.991*** 34.906*** 33.619*** 49.634*** 49.58*** 46.529*** 17.838*** 18.872*** 16.442***
hypervolume_BAT_richness 65.974*** 55.474*** 44.959*** 30.603*** 27.608*** 23.517*** 49.959*** 40.682*** 33.453*** 23.359*** 20.178*** 17.03***
convex hull_BAT_richness 38.128*** 43.105*** 41.169*** 20.963*** 23.36*** 23.19*** 30.242*** 32*** 30.807*** 11.358*** 12.664*** 11.098***
dendrogram_BAT_richness 31.477*** 37.305*** 34.81*** 23.064*** 30.805*** 31.594*** 24.364*** 30.483*** 32.403*** 8.065*** 11.123*** 11.106***

Plots per stressor

Figure 1: Simulation results: the y axes represent the different metrics tested (sorted by categories). The different columns represent the different stressors. The x-axes represent the metric values centred on the random changes and scaled by the maximum value for each metric between the four stressors. Negative and positive values signify a decrease/increase in the metric score. The dots represent the median metric value, the full line their 50% confidence interval (CI) and the dashed line their 95% CI. The colours are just here to visually separate the metrics rows but the colour gradient within each row corresponds to a removal of respectively 80%, 60%, 40% and 20% of the data (from top to bottom). Grey lines in the background are a fitted linear model on the scaled metric score function of removal amount and the value displayed is the adjusted R^2 from each of these models. Dashed grey lines represent non-significant models (slope or/and intercept). The grey line plots represent (CI + median) represent distribution of metrics scores not clearly different from the random metric scores (paired t-test p value > 0.05).

Results interpretations in the light of our expectation table

These were our expectations:

Mechanism Richness Dispersion Regularity
Equalizing Lower Lower Higher
Facilitation Higher Higher Higher
Filtering (exclusion) Higher Higher Higher
Competition Lower Lower Nothing

And these are our results per metric family:

NOTE: the difference between [ok] and [-ok] is actually not really meaningful here since these graphs shows differences compared to the null results so if both the null and stressor results increase but the stressor increases slowlier than the stressor, the results in the table will decrease. Although in general, if this is the case, this is a "bad" results since ideally we would want the null to not change at all (i.e. if the metric is just picking up changes in number of elements, this is not really useful).

Tree (dissimilarity)

Mechanism Richness (alpha) Dispersion Regularity
Equalizing [ok] Lower [ok] Lower [-ok] Higher
Facilitation [NO] Higher [-ok] Higher [-ok] Higher
Exclusion [NO] Higher [-ok] Higher [-ok] Higher
Competition [ok] Lower [ok] Lower [NO] Nothing

FD

Mechanism Richness (Rao) Dispersion Regularity
Equalizing [NO] Lower [ok] Lower [-ok] Higher
Facilitation [NO] Higher [-ok] Higher [NO] Higher
Exclusion [-ok] Higher [-ok] Higher [-ok] Higher
Competition [ok] Lower [ok] Lower [NO] Nothing

hypervolume

Mechanism Richness (Rao) Dispersion Regularity
Equalizing [NO] Lower [-ok] Lower [-ok] Higher
Facilitation [-ok] Higher [NO] Higher [NO] Higher
Exclusion [NO] Higher [NO] Higher [NO] Higher
Competition [ok] Lower [NO] Lower [ok] Nothing

TPD

Mechanism Richness (Rao) Dispersion Regularity
Equalizing [NO] Lower [ok] Lower [-ok] Higher
Facilitation [NO] Higher [-ok] Higher [-ok] Higher
Exclusion [NO] Higher [-ok] Higher [-ok] Higher
Competition [NO] Lower [ok] Lower [NO] Nothing

Other

I actually don't remember of the top of my head what the convex.hull and melodic rao/mpd are representing.

Metrics correlations

And finally below are all the correlations per stressor between each metric per removal levels (20, 40, 60, 80%).

TODO: do the PCA plots as suggested by Carlos to see things clearlier.

Equalizing

Metrics correlation for equalizing with 20% removal

Metrics correlation for equalizing with 40% removal

Metrics correlation for equalizing with 60% removal

Metrics correlation for equalizing with 80% removal

Facilitation

Metrics correlation for facilitation with 20% removal

Metrics correlation for facilitation with 40% removal

Metrics correlation for facilitation with 60% removal

Metrics correlation for facilitation with 80% removal

Filtering

Metrics correlation for filtering with 20% removal

Metrics correlation for filtering with 40% removal

Metrics correlation for filtering with 60% removal

Metrics correlation for filtering with 80% removal

Competition

Metrics correlation for competition with 20% removal

Metrics correlation for competition with 40% removal

Metrics correlation for competition with 60% removal

Metrics correlation for competition with 80% removal

Responses

Carlos: -TPD richness potential error: * I have double checked the scaling and everything seems OK (but I might be mistaken!) The centreing logic happens here: https://github.com/TGuillerme/eco_metrics_simulations/blob/c2a8deb9d673e0456f315d9a9f43285aafdfea93/Functions/extract.table.R#L59 and the scaling logic happens here: https://github.com/TGuillerme/eco_metrics_simulations/blob/c2a8deb9d673e0456f315d9a9f43285aafdfea93/Functions/extract.table.R#L30 (l.30 to 32)). So it might be something with the bandwidth? The whole calculations for the TPD metrics happens here (https://github.com/TGuillerme/eco_metrics_simulations/blob/c2a8deb9d673e0456f315d9a9f43285aafdfea93/Functions/simulation.pipeline.R#L262) with no obvious bandwidth part (at least to my eyes). So maybe it's just using the defaults?

-A minor comment regarding plots: - [ ] TODO: reorganise plots labels (follow Stefano's pdf) - [ ] TODO: reorganise colours by "Richness / Divergence / Regularity" - [ ] TODO: change Convex.hull = Richness; Rao/mpd = Divergence

-Thomas, I would be happy to make the PCAs if you could send me a file with the correlation matrices

Let's talk about the two points on the expectations and the biological realism!